package com.itdl.condition;

import org.springframework.context.annotation.Condition;
import org.springframework.context.annotation.ConditionContext;
import org.springframework.core.type.AnnotatedTypeMetadata;

/**
 * @author: itdl
 * @date: 2022/3/7 14:22
 * @description: fastdfs条件类，用于开启和关闭fastdfs功能
 * @version: 1.0
 */
public class FastDfsCondition implements Condition {
    @Override
    public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) {
        String property = context.getEnvironment().getProperty("itdl.filesystem.fastdfs.enable");
        return Boolean.parseBoolean(property);
    }
}
